define([
  'utils/Conf',
  'models/Model',
  'collections/Familiars'
], function(Conf, Model, Familiars){
  var Internal = Model.extend({
    initialize: function() {
      this.familiars = new Familiars([],{internal: this, limit: 5});
    },
    
    url: function() {
      var urlBase = Conf.routes.internals.list;
      if(this.id) {
        urlBase += "/" + this.id;
      }
      return urlBase;
    },

    toJSON: function() {
      var json = Model.prototype.toJSON.call(this);
      // Augment json object with familiars
      json.familiars = this.familiars.toJSON();

      return json;
    }

   });

  return Internal;
});
